<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../../favicon.ico" rel="shortcut icon" />
<link href="../../base.css" rel="stylesheet" type="text/css" media="screen" />
<script src="../../jquery/jquery.js" type="text/javascript"></script>
<script src="../../event.drag/jquery.event.drag.js" type="text/javascript"></script>
<title>jquery.event.drag</title>
</head><body>

<a href="./">&laquo; Index</a>

<style type="text/css" media="screen">
.dragparent {
	position: relative;	
	}
.box {
	position: absolute;
	height: 48px;
	width: 48px;
	background: #CCF;
	border: 1px solid #AAD;
	cursor: move;
	}
.active {
	background-color: #CFC;
	border-color: #ADA;
	}
</style>

<script type="text/javascript">
jQuery(function($){
	var x = 125, y = 125, radius = 100, angle,
	offset = $('#dragdemo')
		.bind('drag',function( event ){
			angle = Math.atan2( event.pageX - x - offset.left, event.pageY - y - offset.top );
			$( this ).css({
				top: y + Math.cos( angle ) * radius - 25,
				left: x + Math.sin( angle ) * radius - 25
				});
			})
		.offset();
	});
</script>

<h2>event.drag / circular</h2>
<div class="dragparent">
    <div class="box" id="dragdemo"></div>
    </div>
</body></html>